<%--
 ~ Copyright 2009-2015 by WWW.KNET.CN  All rights reserved.
 create by zhangbin
 --%>
<%@ tag language="java" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ attribute name="id" type="java.lang.String" required="false" description="html属性id"%>
<%@ attribute name="name" type="java.lang.String" required="false" description="html属性name"%>
<%@ attribute name="withAll" type="java.lang.String" required="false" description="是否包含全部按钮"%>
<%@ attribute name="allName" type="java.lang.String" required="false" description="all按钮返回为空的名称"%>
<%@ attribute name="withWu" type="java.lang.String" required="false" description="是否包含无类型"%>
<%@ attribute name="status" type="java.lang.String" required="false" description="是否为某种状态的,OPEN,CLOSE 其他为全部"%>
<%@ attribute name="cssClass" type="java.lang.String" required="false" description="css样式"%>
<%@ attribute name="cssStyle" type="java.lang.String" required="false" description="css样式"%>
<%@ attribute name="defaultValue" type="java.lang.String" required="false" description="默认选择的值"%>
<c:if test="${empty id}">
    <c:set var="id" value="productType"/>
</c:if>
<c:if test="${empty name}">
    <c:set var="name" value="productType"/>
</c:if>
<c:choose>
    <c:when test="${empty status}">
        <c:set var="status" value="OPEN"/>
    </c:when>
    <c:otherwise>
        <c:choose>
            <c:when test="${status ne 'OPEN' and status ne 'CLOSE' and status ne 'ALL'}">
                <c:set var="status" value="OPEN"/>
            </c:when>
            <c:otherwise>
                <c:if test="${status eq 'ALL'}">
                    <c:set var="status" value=""/>
                </c:if>
            </c:otherwise>
        </c:choose>
    </c:otherwise>
</c:choose>

<c:if test="${empty allName}">
    <c:set var="allName" value="全部"/>
</c:if>
<select id="${id}" name="${name}" style="${cssStyle}" class="${cssClass}">
    <c:if test="${withAll eq 'true'}">
        <option value="">${allName}</option>
    </c:if>
    <c:if test="${withWu eq 'true'}">
        <option value="WU">无</option>
    </c:if>
    <c:forEach items="${fns:listProductType(status)}" var="item">
        <option <c:if test="${item.productTypeValue eq defaultValue}">selected="selected"</c:if> value="${item.productTypeValue}">${item.productTypeName}</option>
    </c:forEach>
</select>